home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / windows / games / nilbuild.arj / NILBUILD.WBT < prev   
Text File  |  1993-01-13  |  5KB  |  132 lines

  1. ;*****************************************************************************
  2. ;
  3. ; NILBUILD.WBT
  4. ; This program launches the Norton Icon Editor and imports multiple .ICO files
  5. ; into an .NIL format library.  Norton BATCHRUN is required to run.
  6. ;
  7. ; The user MUST specify:  1) the FULL pathname of the .NIL file
  8. ;                         2) a directory containing the ICON files
  9. ;
  10. ; NILBUILD will attempt to import every .ICO file in the directory specified
  11. ; in #2.  At the end of program execution, ICONBUILD will issue a report giving
  12. ; the filenames of any unreadable icons.
  13. ;
  14. ; Note:  This program works mainly by sending keystrokes to ICONEDIT and was
  15. ; created with the help of the Norton Macro Builder.  Since it works by
  16. ; sending keystrokes to another program, it is difficult to tell when any
  17. ; given keyed sequence has generated an error.  However, ICONEDIT normally
  18. ; creates a child window of the same title ("Norton Icon Editor") to display
  19. ; error messages.  If the parent window, "Norton Icon Editor", is renamed to,
  20. ; say, "Building Icon...", one can detect the presence of an error condition
  21. ; by detecting the "Norton Icon Editor" child window.  (e.g. WinExist("..."))
  22. ;
  23. ; See the file NILBUILD.DOC for further information.
  24. ;
  25. ; Copyright (C) 1993, by Bob Staudenmaier
  26. ; This program may be freely distributed in its original form.  Permission
  27. ; is given to modify the program for personal use only.
  28. ;
  29. ;*****************************************************************************
  30. ;
  31. ; User modifiable definitions
  32.  
  33. NDWDir="c:\ndw"                                 ;path of NDW directory
  34. DefLib="c:\ndw\iconlib.nil"                     ;pathname of default library
  35. DefIcoDir="c:\icons"                            ;default .ICO directory
  36.  
  37.  
  38. ; First, get the name of the .NIL library to open.  Check for non-NIL type.
  39.  
  40. NilBuild="Building icon library...Please wait!!"
  41.  
  42. :Start
  43. LibName=AskLine(NilBuild,"What is the FULL pathname of the .NIL library?",DefLib)
  44. Position=StrLen(LibName)-3
  45. Extension=StrUpper(StrSub(LibName,Position,4))
  46. If Extension == ".NIL" then goto Launch
  47. Message("ERROR","File is NOT type .NIL!")
  48. Goto Start
  49.  
  50. ; Launch Icon Editor and open the specified .NIL library file.  If the open is
  51. ; successful, the Icon Editor window title will say "Norton ... Mode: LIB"
  52.  
  53. :Launch
  54. Run("%NDWDir%\iconedit.exe",LibName)
  55. WinActivate("Norton Icon Editor")
  56. Title=WinGetActive()
  57. Position=StrLen(Title)-2
  58. If StrSub(Title,Position,3)=="LIB" then goto GetIcoDir
  59. WinTitle(Title,NilBuild)
  60. WinWaitClose(NilBuild)
  61. WinClose(Title)
  62. Goto Start
  63.  
  64. ; Now get the name of the icon directory to import .ICO files from.
  65. ; Rename the Norton Icon Editor window so we can check for errors.
  66.  
  67. :GetIcoDir
  68. WinTitle(Title,NilBuild)
  69. :Again
  70. IcoDir=AskLine(NilBuild,"What is the name of the .ICO directory?",DefIcoDir)
  71. WinActivate(NilBuild)
  72. SendKey(`!fi%IcoDir%{ENTER}`)
  73. If ! WinExist("Norton Icon Editor") then goto GetFileList
  74. WinWaitClose("Norton Icon Editor")
  75. WinClose("Import Icon")
  76. Goto Again
  77.  
  78. ; Get the list of icons to import.  Determine the number of icons.
  79. ; Give error message if no .ICO files present in directory.
  80.  
  81. :GetFileList
  82. FileList=FileItemize("%IcoDir%\*.ico")
  83. IconCount=ItemCount(FileList," ")
  84. If IconCount!=0 then goto Import
  85. Beep
  86. Message("ERROR - No icons","Directory contains no .ICO files!")
  87. WinClose("Import Icon")
  88. Goto Again
  89.  
  90. ; Now we're ready to start importing icons. First remember to close the
  91. ; "Import Icon" window so that the first icon can be read by the same routine
  92. ; as all the others. Icon filenames are extracted individually from "FileList".
  93. ; If a filename generates an error, it is added to the string "BadIcons".
  94.  
  95. :Import
  96. WinClose("Import Icon")
  97. Count=0                ;# of icons imported
  98. BadIcons=""            ;List of icons that can't be read
  99.  
  100. :Loop
  101. Count=Count+1
  102. If Count>IconCount then goto Finish
  103. FileName=ItemExtract(Count,FileList," ")
  104.  
  105. SendKey(`!fi%FileName%{ENTER}`)
  106. If !WinExist("Norton Icon Editor") then goto ReadOK
  107. SendKey(`{ENTER}`)
  108. WinClose("Import Icon")
  109. BadIcons=StrCat(BadIcons,ItemExtract(1,FileName,".")," , ")
  110. Goto Loop
  111.  
  112. :ReadOK
  113. SendKey(`{ENTER}!i`)
  114. Goto Loop
  115.  
  116. ; Finish routine.  Check to see if there were any bad icons in the
  117. ; directory.  If not, inform user that there were no errors.  If there were
  118. ; errors, list the bad icons for him.
  119.  
  120. :Finish
  121. If BadIcons=="" then goto NoErrors
  122. BadIcons=StrSub(BadIcons,1,StrLen(BadIcons)-3)
  123. Message("TASK COMPLETE -- But the following .ICO files could NOT be read:",BadIcons)
  124. WinTitle(NilBuild,Title)
  125. exit
  126.  
  127. :NoErrors
  128. Message("TASK COMPLETE -- NO ERRORS","There were %IconCount% .ICO files read.")
  129. WinTitle(NilBuild,Title)
  130. exit
  131.  
  132.